<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title><?= $systemConfig['system_name'] ?? '实名认证分发系统' ?></title>
<link rel="stylesheet" href="/layui/css/layui.css">
<script src="/static/js/jquery.min.js"></script>
<script src="/layui/layui.js"></script>
<style>
*{margin:0;padding:0;box-sizing:border-box;}
body{font-family:"Microsoft YaHei","PingFang SC",sans-serif;background:#f5f7fa;}
.header{background:#fff;box-shadow:0 1px 4px rgba(0,0,0,.08);position:sticky;top:0;z-index:100;}
.header .inner{max-width:1200px;margin:0 auto;display:flex;align-items:center;justify-content:space-between;padding:0 20px;height:60px;}
.header .logo{font-size:20px;font-weight:700;color:#1e3c72;text-decoration:none;}
.header .nav{display:flex;gap:20px;}
.header .nav a{color:#555;text-decoration:none;font-size:14px;padding:8px 12px;border-radius:4px;transition:.3s;}
.header .nav a:hover{color:#1e9fff;background:#f0f7ff;}
.header .nav .btn{background:#1e9fff;color:#fff;padding:8px 20px;border-radius:4px;}
.footer{text-align:center;padding:30px 20px;color:#999;font-size:13px;background:#fff;margin-top:40px;border-top:1px solid #eee;}
.container{max-width:1200px;margin:0 auto;padding:20px;}
.banner{background:linear-gradient(135deg,#1e3c72 0%,#2a5298 100%);color:#fff;text-align:center;padding:80px 20px 60px;}
.banner h1{font-size:40px;margin-bottom:16px;}
.banner p{font-size:18px;opacity:.85;margin-bottom:24px;}
.banner .layui-btn{height:44px;line-height:44px;padding:0 36px;font-size:16px;border-radius:6px;margin:0 8px;}
.features{display:flex;flex-wrap:wrap;gap:20px;margin:40px 0;}
.feature-card{flex:1;min-width:250px;background:#fff;padding:30px 20px;border-radius:12px;text-align:center;box-shadow:0 2px 12px rgba(0,0,0,.05);}
.feature-card .icon{font-size:44px;margin-bottom:12px;}
.feature-card h3{font-size:18px;margin-bottom:8px;color:#333;}
.feature-card p{color:#666;font-size:14px;line-height:1.6;}
.package-card{background:#fff;border-radius:12px;padding:24px;box-shadow:0 2px 12px rgba(0,0,0,.05);margin-bottom:16px;display:flex;justify-content:space-between;align-items:center;}
.package-card .info .name{font-size:18px;font-weight:600;color:#333;}
.package-card .info .channel{color:#888;font-size:13px;margin-top:4px;}
.package-card .meta{text-align:center;min-width:120px;}
.package-card .meta .price{font-size:24px;color:#ff5722;font-weight:700;}
.package-card .meta .limit{color:#666;font-size:13px;margin-top:4px;}
</style>
</head>
<body>
<div class="header"><div class="inner">
    <a href="/" class="logo"><?= $systemConfig['system_name'] ?? '实名认证分发系统' ?></a>
    <div class="nav">
        <a href="/">首页</a><a href="/user/index/packages">套餐市场</a><a href="/user/index/apiDoc">接入文档</a>
        <?php if($userId): ?>
        <a href="/user/index/dashboard">控制台</a><a href="/user/index/profile">个人中心</a><a href="/user/index/logout">退出</a>
        <?php else: ?>
        <a href="/user/index/login">登录</a><a href="/user/index/register" class="btn">免费注册</a>
        <?php endif; ?>
    </div>
</div></div>
<div class="banner">
    <h1><?= htmlspecialchars($systemConfig['home_slogan'] ?? '安全、稳定、高效的实名认证服务') ?></h1>
    <p>无需企业资质，即可接入腾讯云、阿里云等主流实名认证服务</p>
    <a href="/user/index/register" class="layui-btn layui-btn-normal">立即注册</a>
    <a href="/user/index/packages" class="layui-btn layui-btn-warm">查看套餐</a>
</div>
<div class="container">
    <div class="features">
        <div class="feature-card"><div class="icon">🔐</div><h3>安全可靠</h3><p>对接腾讯云、阿里云等主流实名认证服务商，数据安全有保障</p></div>
        <div class="feature-card"><div class="icon">⚡</div><h3>快速接入</h3><p>提供标准化API接口和多语言SDK，最快5分钟完成接入</p></div>
        <div class="feature-card"><div class="icon">💰</div><h3>灵活计费</h3><p>多种套餐选择，按次计费，无需高额预付，成本可控</p></div>
        <div class="feature-card"><div class="icon">📊</div><h3>数据监控</h3><p>实时调用统计，详细的API调用日志，使用情况一目了然</p></div>
    </div>
    <h2 style="text-align:center;margin:40px 0 20px;color:#333;">热门套餐</h2>
    <?php if(!empty($packages)): foreach(array_slice($packages, 0, 6) as $pkg): ?>
    <div class="package-card">
        <div class="info">
            <div class="name"><?= $pkg['name'] ?></div>
            <div class="channel"><?= $pkg['channel_name'] ?> · <?= $pkg['channel_type'] ?></div>
            <?php if(!empty($pkg['description'])): ?><div class="desc" style="color:#999;margin-top:4px;"><?= $pkg['description'] ?></div><?php endif; ?>
        </div>
        <div class="meta">
            <div class="price">¥<?= number_format($pkg['price'], 2) ?></div>
            <div class="limit"><?= $pkg['call_limit'] ?>次 / <?= $pkg['valid_days'] ?>天</div>
            <?php if($userId): ?>
            <a href="javascript:void(0)" onclick="buyPackage(<?= $pkg['id'] ?>)" class="layui-btn layui-btn-sm layui-btn-normal" style="margin-top:8px;">立即购买</a>
            <?php else: ?>
            <a href="/user/index/login" class="layui-btn layui-btn-sm" style="margin-top:8px;">登录购买</a>
            <?php endif; ?>
        </div>
    </div>
    <?php endforeach; else: ?>
    <div style="text-align:center;padding:40px;color:#999;">暂无套餐，请关注后续更新</div>
    <?php endif; ?>
    <div style="text-align:center;margin-top:16px;"><a href="/user/index/packages" class="layui-btn layui-btn-primary">查看全部套餐</a></div>
</div>
<div class="footer">
    <?= $systemConfig['copyright'] ?? '' ?><br>
    <?php if(!empty($systemConfig['icp_number'])): ?><?= $systemConfig['icp_number'] ?><br><?php endif; ?>
    <?php if(!empty($systemConfig['contact_phone'])): ?>联系电话: <?= $systemConfig['contact_phone'] ?><?php endif; ?>
</div>
<script>
function buyPackage(packageId){
    <?php if(!$userId): ?>layer.msg('请先登录');return;<?php endif; ?>
    layer.confirm('确认购买此套餐？<br><small style="color:#999;">支付方式：线下转账后联系管理员确认</small>', function(index){
        $.post('/user/index/buyPackage', {package_id:packageId}, function(res){
            layer.msg(res.msg, {icon:res.code===0?1:2});
            if(res.code===0 && res.data.order_no){
                layer.alert('订单号：<b>'+res.data.order_no+'</b><br>请完成支付后联系管理员确认', {title:'订单已生成'});
            }
        });
    });
}
</script>
</body>
</html>